#pragma once
#include <pthread.h>
#include <iostream>
class Task
{
    private:
	    int x;
	    int y;
	    char op;
    public:
	    Task(){}
	    Task(int _x,int _y,char _op):x(_x),y(_y),op(_op)
	{}
	    void run()
	    {
		    int z = -1;
		    switch(op)
		    {
			    case '+': z = x+y;
				    break;
		            case '-': z = x-y;
				    break;
			    case '*': z = x*y;
				    break;
			    case '/': if(y!=0) z = x/y;
			              else  std::cout << "Warning: div zero!" << std::endl;
				    break;
		            case '%': if(y!=0) z = x%y;
				      else  std::cout << "Warning: div zero!" <<std::endl;
				    break;
			    default:
				    std::cout << "unknown operator!" << std::endl;
				    break;
		    }
		    printf("Thread[%lld] : ",pthread_self());
		    std::cout << x << op << y << '=' << z << std::endl;
	    }

};
